/*
 * Copyright 2008 Wink Saville
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import com.saville.debug.*;
import com.saville.msgcomp.*;
import com.saville.mc.*;

public class TestServer1 extends ActiveMc {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new TestServer1();
    }

    TestServer1() {
        super("TestServer1");
        df = Log.VERBOSE;
        // mMcMgr.df = Log.VERBOSE;
    }

    @Override
    public void processMsg(Msg msg) {
        if (msg.is(McConst.MC_GUID, McConst.MC_CMD_STARTED)) {
            Log.v(df, "%s: processMsg; STARTED dstId=%d guid=0x%x cmd=0x%x", mName, msg.dstId,
                msg.guid, msg.cmd);
        } else if (msg.is(McConst.MC_GUID, McConst.MC_CMD_ECHO)) {
            Log.v(df, "%s: processMsg; ECHO dstId=%d guid=0x%x cmd=0x%x", mName, msg.dstId,
                msg.guid, msg.cmd);
            sendReplyMsg(msg, McConst.STATUS_ECHO);
        } else if (msg.cmdIsRequest()) {
            Log.v(df, "%s: processMsg; UNKNOWN dstId=%d guid=0x%x cmd=0x%x", mName, msg.dstId,
                msg.guid, msg.cmd);
            sendReplyMsg(msg, McConst.STATUS_ERR);
        } else {
            Log.v(df, "%s: processMsg; DROP dstId=%d guid=0x%x cmd=0x%x", mName, msg.dstId,
                msg.guid, msg.cmd);
        }
    }
}
